package id;

import java.util.HashMap;

public class IdentificationSystems {

    public static void main(String[] args) throws Exception {
        CertificateAuthority CA = new CertificateAuthority();
        String sectorA = "sector A";
        String sectorB = "sector B";

        String user = "user name";
        Card card = new Card(user);

        System.out.println("Generating certificates for sectors A and B...");
        card.registerForSector(sectorA, CA);
        System.out.println("Generation for sector A successful.");
        card.registerForSector(sectorB, CA);
        System.out.println("Generation for sector B successful.");

        String message = "this is a random message!";

        System.out.println("\nGenerating signature with sector A key...");
        HashMap<String, Object> signatureA = card.sign(message, sectorA);
        System.out.print("Verifying signature...");
        System.out.println(card.verify(signatureA, sectorA) ? " correct!" : " incorrect!");
        System.out.println("\nGenerating signature with sector B key...");
        HashMap<String, Object> signatureB = card.sign(message, sectorB);
        System.out.print("Verifying signature...");
        System.out.println(card.verify(signatureB, sectorB) ? " correct!" : " incorrect!");
    }
}
